package com.spancer.contentcenter.service;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * author by: mars
 * Date: 2020/9/28 11:00
 * Description: sentinel 的测试service
 */
@Service
@Slf4j
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class TestService {

    private final RocketMQTemplate rocketMQTemplate;

    @SentinelResource("common")
    public String common(){
        log.info("common....");
        return "common";
    }

    public void producerSendMsg(){
        rocketMQTemplate.convertAndSend("producerTest","happy 11.11");
    }
}
